package com.bocai.grainshop.product.feign;

import com.bocai.common.to.SkuReductionTo;
import com.bocai.common.to.SpuBoundsTo;
import com.bocai.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("grainshop-coupon")
@Component  //阳哥 坑人强调
public interface CouponFeignService{
    
    /**
     * @Author: SunJinbo
     * @Description  远程调用过程
     * 1.@RequestBoby将这个对象转为json
     * 2.在注册中心找到grainshop-coupon服务，给/coupon/spubounds/save发送请求
     * 3.将上一步转为json放在请求体位置，发送请求
     * 4.对方服务收到请求。请求体里有json数据
     * 5.对方的@RequestBoby SpuBoundsEntity spuBounds 将请求体的json转为SpuBoundsEntity
     * 总结:只要json数据模型是兼容的.双方服务无需使用同一个to
     * @Param [spuBoundsTo]
     * @return com.bocai.common.utils.R      
     * @Data Created in 2022/3/26 19:17
     */
    @PostMapping("/coupon/spubounds/save")
    R savaBounds(@RequestBody  SpuBoundsTo spuBoundsTo);

    @PostMapping("/coupon/skufullreduction/savaInfo")
    R savaInfo(@RequestBody SkuReductionTo skuReductionTo);
}
